/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lesson3.slides.net;

import java.net.*;
import java.io.*;

public class URLReaderExample {
    
    public static String theUrl="http://www.yahoo.com";

    public static void main(String[] args) throws Exception {

        // Open the connection and get a Reader
        URL url = new URL(theUrl);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(url.openStream()));
        // read from the URL 
        String inputLine;
        while ((inputLine = in.readLine()) != null) {
            System.out.println(inputLine);
        }
        in.close();
    }
}
